<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>商品列表</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('blog/coupon/user')}">
        用户昵称：
        <input class="form-control" type="text" name="nick_name" style="width: 200px;" value="{:input('request.nick_name')}" placeholder="请输入用户昵称">
        用户ID：
        <input class="form-control" type="text" name="id" style="width: 200px;" value="{:input('request.id')}" placeholder="请输入用户ID">
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('blog/coupon/user')}">清空</a>
    </form>
    <form action="" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>会员ID</th>
                <th>会员昵称</th>
                <th>请选择</th>
            </tr>
            </thead>
            <tbody>
            <php>
                $user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));
            </php>
           <foreach name="user" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td name="nick_name">{$vo.nick_name}</td>
                    <td><input type="checkbox" name="proid" value="{$vo.m_guid}" width="40px" height="40px";></td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
        <input type="button" name="button" id="button" value="确定">
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>

<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
</body>
</html>
<script>
$('#button').click(function () {
    var obj=document.getElementsByName('proid'); //选择所有name="'test'"的对象，返回数组
    var name='';
    var data='';
    for(var i=0; i<obj.length; i++){
        if(obj[i].checked) data+=obj[i].value+','; //如果选中，将value添加到变量s中
    }
    //那么现在来检测s的值就知道选中的复选框的值了
    if (data=='') {
        alert('你还没有选择任何内容！');
        return false;
    };
    var index = parent.layer.getFrameIndex(window.name);
    $.post("{:url('coupon/username')}",{date:data},function(date){
        var name=date.msg;
        parent.$('#proid').val(name);
        parent.$('#userid').val(data);
        parent.layer.close(index); //执行关闭
    },'json')
})
</script>